home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
ear
/
uniq.readme
< prev
next >
Wrap
Text File
|
1994-06-11
|
5KB
|
158 lines
Uniq V1.1
Written by Oliver Kaufmann
Released on June 10, 1994
This program is Freeware. Copyright 1994 by Oliver Kaufmann.
All Rights Reserved. UNIQ is freely distributable, but the author retains all
rights in regards to the program. Permission is granted to distribute this
program for a minimal charge (for copying, handling, etc.).
Use this program at your own risk, no warranties will be made.
UNIQ is a Shell-command primarily designed to make life easier with file
name length convention on different file systems such as MSDOS, but it is not
limited to that. UNIQ takes its input either from stdin or from the contents
of a specified directory. Its output will give those (file) names that do not
comply with the requested name length followed by a "UNIQified" name, which
is unique to the entire input. Thus it is easy to have those files renamed to
properly comply with the destination filing system name length convention.
1. INSTALLATION
---------------
Copy UNIQ to any directory you like that is in your path.
I. USAGE
--------
uniq [<options>]
-d[<dir>] : use contents of <dir> as input, otherwise use stdin
-a : print all names, even those which do not change
-f : process files only, no dirs (requires -d option)
-q : enclose output in quotes (rename "%s" "%s")
-r : recurse sub-dirs (requires -d option)
-l<lformat> : use <lformat> for formated output (default rename %s %s)
-m[<mformat>] : enable & print <mformat> for dirs (default makedir %s)
-p<pattern> : pattern to apply (default #?)
-b<basenamelength> : max. length of the uniqified string (default 8)
-e<extensionlength> : max. length of the uniqified extension (default 3)
II. WHAT IS IT FOR
------------------
Suppose you've got a lot of pictures taken from internet news, let's say
alt/binaries/pictures. Usually no problem for the Amiga, but possibly a
firend of yours, who's only got a PC running MSDOS, wants to get the
pictures from you. The problem is that some file names are too long for
MSDOS, 8 + 3 = 11 chars max file name length. Even worse many pics do have
allmost the same names except for the last character. If you copy such files
to a MSDOS floppy or harddisk, you will probably get only one out of several.
You may rename them by hand, but that's quite annoying, especially if there
are over 1200 pics in that directory. Now you probably know what UNIQ might
be used for.
III. HOW IT WORKS
-----------------
UNIQ takes its input, applies the pattern, checks the matched input for
consistency with the (specified) length and, if necessary, prints a list of
source names along with their corresponding UNIQified names. The unique
names will be derived from the source names, modified and attached numbers,
while the extension will be preserved, maybe truncated. By default UNIQ
prints 'rename <source file> <unique file>' to stdout. You may redirect
the output to a file and execute it afterwards to have the job done.
Remember that by default UNIQ reads from stdin. If you want to use a
directory as input you have to apply the -d switch (-d is the current,
-d<dir> is any you specify). No path will be printed. Be aware that all
arguments to switches must be directly typed after the switch, no spaces
in between. If reading from stdin without redirection you finish typing by
pressing CTRL-\ twice.
IV. EXAMPLES
-------------
Let's have UNIQ examine the contents of the current directory and list all
files which do not comply with the (default) MSDOS name length convention.
Look at that:
:> uniq -d
Now you can do
:> uniq -d >ram:test.bat
:> execute ram:test.bat
If you don't want to rename the files you can copy them (see the -a for all)
Let's say msd: is the MSDOS DISK
:> uniq -d -a "-lcopy %s msd:%s" >ram:test.bat
:> execute ram:test.bat
Or read from stdin
:> uniq "-lthis is not uniq: %s should be %s" <testfile.idx
Or copy all files from dh0:data recursively to the current dir
:> uniq -ddh0:data -f -q -r "-lcopy %s %s" -m -a
Or copy all files from dh0:data recursively to msd:
Remember that we do NOT use -q here!
:> uniq -ddh0:data -f -r "-lcopy ""%s"" ""msd:%s""" -m -a
2. Inspiration
--------------
This Program was written, because I had to transfer about 400MB of data
gathered from UNIX to a MSDOS harddisk.
3. Misc
-------
This program is far from complete and has not been tested too much, but it
works for me.
4. Source
---------
I've included the source code. Everybody may use it, implement other
features etc. as long as the author is mentioned.
5. The Author
-------------
Oliver Kaufmann
Eserwallstrasse 8
86159 Augsburg
Germany e-mail: kaufmano@informatik.tu-muenchen.de
6.TODO
------
Switch to execute commands on the fly, instead of redirecting output.
7. History
----------
1.02 first release
basic functions, no recursive dirs
1.1 recurse dirs, enclose output in quotes, mformat for dirs
DISCLAIMER: Use this program at your own risk.